package com.wang.blog.dao;

import com.wang.blog.model.MeArticle;
import com.wang.blog.model.MeArticleExample;
import com.wang.blog.ov.ArticleVo;
import com.wang.blog.ov.PageVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * MeArticleDAO继承基类
 */
@Repository
public interface MeArticleDAO extends MyBatisBaseDao<MeArticle, Integer, MeArticleExample> {

    @Select("select * from me_article order by view_counts desc limit #{limit}")
     List<MeArticle> listHotArticlsBylimit(Integer limit);

    @Select("select * from me_article order by create_date desc limit #{limit}")
     List<MeArticle> listNewArtuclsBylimit(Integer limit);

    @Select("select year(create_date) as year,month(create_date) as month,count(*) as count from me_article group by year(create_date),month(create_date)")
    List<ArticleVo> listArticlsTime();


    List<MeArticle> listArticlsByArticOVandPageOv(@Param("articlov") ArticleVo articleVo, @Param("pageov")PageVo page);
}